The magnetic tape unit has been used as an external memory device for a computer. Recently, in order to accommodate to an increase of magnetic tape performance, a magnetic tape unit of streaming system has being popularized. In such streaming type magnetic tape unit, the tape running is directly controlled by a reel motor, without stopping the tape in an inter-block gap (referred to as "IBG, hereinafter) which is a blank portion between adjacent data blocks.
In the magnetic tape unit of streaming system, the number of stoppages of magnetic tape is desirably as small as possible since acceleration/deceleration of tape requires a long time. Pre-read/Post write is one of methods for reducing the number of required stoppages of magnetic tape.
For pre-read, a buffer is provided between a host system and a read/write control portion. A pre-read control unit for controlling pre-read operation reads data more than that instructed by the upper device. Data read out is temporarily stored in the buffer. The term "pre-read" is to start read operation before instruction from the host system. When the upper device accesses pre-read data, the data is sent from the buffer to the host system. Since there is no need of stopping magnetic tape every completion of read of data block instructed by the upper device, the number of tape stoppages is reduced.
In pre-reading, it is necessary to judge a data position at which a pre-read is to be stopped. When size of data read out is larger than an available capacity of the buffer, that data can not be stored in the buffer. In order to read the data which could not be stored in the buffer, the magnetic tape must be rewound back to a head of the data block. There are at least five steps to be executed from the rewinding of tape to re-read of the data block. The five steps are as follows:
(1) Acceleration and deceleration of tape for positional correction. This positional correction is necessary to run the tape in a reverse direction. PA1 (2) Acceleration, transportation and deceleration for running the tape in the reverse direction. PA1 (3) Acceleration and deceleration for positional correction. This positional correction is necessary to correct a distance required for deceleration. PA1 (4) Acceleration and deceleration for positional correction. This positional correction is necessary to run the tape and re-read the data. PA1 (5) Tape transportation for re-reading the data.
Each of these steps includes acceleration/deceleration of tape. Therefore, in order to execute the series of steps, a long time is required. On the other hand, if the pre-read is stopped at an appropriate block, it is possible to read data immediately by only one acceleration. Therefore, the judgement as to a block at which the pre-read is to be interrupted has a considerable influence effective transfer rate.
If the size of data block is constant, the judgement as to interruption of pre-read is easy since it is enough to stop pre-read when the available capacity of the buffer becomes equal to or smaller than the size of the data block. A threshold value of the available capacity of the buffer at which pre-read is to be interrupted is referred to as "buffer margin". In this case, the buffer margin equals to the size of the data block.
When respective data blocks are different in size, the judgement of interruption of pre-read is difficult since it is necessary to predict change of block size and change the buffer margin correspondingly to a predicted change.
In a prior art for performing a pre-read under the circumstance, size of a preceding data block read out is set as the buffer margin and the pre-read is continued when the preceding data block size is smaller than an available capacity of a buffer or interrupted when it is larger than the available buffer capacity.
Such judgement is effective of data blocks of identical size appear successively. A case where 100 data blocks each having size of 64 kB appear successively and thereafter 100 data blocks each having size of 128 kB appear successively is an example of the above condition. In this case, the size of every data block is 64 kB in a time period from a completion of read of a first data block to a start of read of a 101th data block and 128 kB in a time period from a completion of read of the 101th data block to a completion of read of a 200th data block. The size of the data block read out is different from the buffer margin at only the 101th data block.
On the other hand, in a case where large data blocks appear sporadically, the efficiency of buffer utilization is lowered when the above-mentioned prior art is used. That is, assuming a case where a data block having size of 128 kB appears when usual block size is 64 kB, the buffer margin may be set at 128 kB temporarily. Therefore, in this case, pre-read is interrupted when an available capacity of the buffer is not larger than 128 kB, even if size of a following data block is 64 kB and the available buffer capacity is not smaller than 64 kB. Such premature interruption of pre-read occurs every data block of 128 kB and thus the utilization efficiency of the buffer is lowered when such large data blocks appear sporadically repetitively.
Such sporadic appearance of large data blocks may occur frequently when an auto-blocking technology is used. The auto-blocking technology is used to form a data block having size substantially equal to a reference value from a set of small data pieces called packets. The auto-blocking technics will be described later.